package v1

import (
	"gluenet/internal/agent/driver/helmdriver/search"

	docker "github.com/fsouza/go-dockerclient"
	"helm.sh/helm/v3/pkg/release"
)

type Host struct {
	HostName string `json:"hostName" yaml:"hostName"`
	HostIP   string `json:"hostIp" yaml:"hostIp"`
	HostMac  string `json:"hostMac" yaml:"hostMac"`
	CPUCores string `json:"cpuCores" yaml:"cpuCores"`
	MemSize  string `json:"memSize" yaml:"memSize"`
	Arch     string `json:"arch" yaml:"arch"`
	OS       string `json:"os" yaml:"os"`
	Tags     string `json:"tags" yaml:"tags"`
}
type Container struct {
	Name             string                   `json:"name" yaml:"name"`
	Config           *docker.Config           `json:"config" yaml:"config"`
	HostConfig       *docker.HostConfig       `json:"host_config" yaml:"host_config"`
	NetworkingConfig *docker.NetworkingConfig `json:"networking_config" yaml:"networking_config"`
}

type ContainerOptions struct {
	BlkioWeight        int    `json:"BlkioWeight"`
	CPUShares          int    `json:"CpuShares"`
	CPUPeriod          int    `json:"CpuPeriod"`
	CPURealtimePeriod  int64  `json:"CpuRealtimePeriod"`
	CPURealtimeRuntime int64  `json:"CpuRealtimeRuntime"`
	CPUQuota           int    `json:"CpuQuota"`
	CpusetCpus         string `json:"CpusetCpus"`
	CpusetMems         string `json:"CpusetMems"`
	Memory             int    `json:"Memory"`
	MemorySwap         int    `json:"MemorySwap"`
	MemoryReservation  int    `json:"MemoryReservation"`
	KernelMemory       int    `json:"KernelMemory"`
}

type ContaienrDetial struct {
	*docker.Container `json:",inline"`
}
type Compose struct {
	Yaml string `json:"yaml"`
}

type Release struct {
	ReleaseName   string `json:"release_name" yaml:"release_name"`
	ChartName     string `json:"chart_name" yaml:"chart_name"`
	Version       string `json:"version" yaml:"version"`
	AddtionValues string `json:"addtion_value" yaml:"addtion_value"`
}

type ChartDetial struct {
	*search.Result `json:",inline" `
}

type ReleaseDetial struct {
	*release.Release `json:"release"`
	Containers       []string `json:"containers"`
}

type VirtualMachine struct {
	Yaml string `json:"yaml"`
}

type VirtualMachineService struct {
	// Name of the virtual Machine Instance created for the exposure
	VirtualMachineInstanceName string `json:"vmi_name"`

	// Name of the service created for the exposure of the VM
	Name string

	// Type for this service: ClusterIP, NodePort, or LoadBalancer. (default "ClusterIP")
	Type string `json:"type" yaml:"type"`

	// The port that the service should serve on
	Port int32 `json:"port" yaml:"port"`

	// Name or number for the port on the VM that the service should direct traffic to. Optional.
	TargetPort int32 `json:"target_port" yaml:"target_port"`

	Entry string `json:"entry,omitempty" yaml:"entry"`
}

type VirtualMachineInstance struct {
	VirtualMachineInstanceName string `json:"vm_name"`
	VirtualMachine             `json:",inline"`
	Services                   []VirtualMachineService `json:"services"`
}

type ProxyGet struct {
	HttpUrl string            `json:"httpUrl" yaml:"httpUrl"`
	Params  map[string]string `json:"params" yaml:"params"`
}

type ProxyPost struct {
	HttpUrl string                 `json:"httpUrl" yaml:"httpUrl"`
	Body    map[string]interface{} `json:"body" yaml:"body"`
}

type ProxyRequest struct {
	HttpUrl string                 `json:"httpUrl" yaml:"httpUrl"`
	Method  string                 `json:"method" yaml:"method"`
	Headers map[string]string      `json:"headers" yaml:"headers"`
	Params  map[string]string      `json:"params" yaml:"params"`
	Body    map[string]interface{} `json:"body" yaml:"body"`
}

type MaasReq struct {
	MaasURL   string            `json:"maasUrl" yaml:"maasUrl"`
	APIKey    string            `json:"apiKey" yaml:"apiKey"`
	Version   string            `json:"version" yaml:"version"`
	Function  string            `json:"function" yaml:"function"`
	GetParams string            `json:"getParams" yaml:"getParams"`
	Value     map[string]string `json:"value" yaml:"value"`
}

type CprofileFlame struct {
	Guid      string `json:"guid" yaml:"guid"`
	Pod       string `json:"pod" yaml:"pod"`
	Container string `json:"container" yaml:"container"`
}

type CprofileFile struct {
	Pod       string `json:"pod" yaml:"pod"`
	Container string `json:"container" yaml:"container"`
	URL       string `json:"url" yaml:"url"`
}

type JaegerService struct {
	URL  string `json:"url" yaml:"url"`
	Guid string `json:"guid" yaml:"guid"`
}

type JaegerOperate struct {
	URL     string `json:"url" yaml:"url"`
	Guid    string `json:"guid" yaml:"guid"`
	Service string `json:"service" yaml:"service"`
}

type JaegerTraces struct {
	URL         string `json:"url" yaml:"url"`
	Guid        string `json:"guid" yaml:"guid"`
	Service     string `json:"service" yaml:"service"`
	Operation   string `json:"operation" yaml:"operation"`
	Limit       string `json:"limit" yaml:"limit"`
	Start       string `json:"start" yaml:"start"`
	End         string `json:"end" yaml:"end"`
	LookBack    string `json:"lookBack" yaml:"lookBack"`
	MaxDuration string `json:"maxDuration" yaml:"maxDuration"`
	MinDuration string `json:"minDuration" yaml:"minDuration"`
	Tags        string `json:"tags" yaml:"tags"`
}

type PromQuery struct {
	Query string `json:"query" yaml:"query"`
	Time  string `json:"time" yaml:"time"`
}

type PromQueryRange struct {
	Query string `json:"query" yaml:"query"`
	Start string `json:"start" yaml:"start"`
	End   string `json:"end" yaml:"end"`
	Step  string `json:"step" yaml:"step"`
}

type LogCounts struct {
	Start     string `json:"start" yaml:"start"`
	Guid      string `json:"guid" yaml:"guid"`
	Container string `json:"container" yaml:"container"`
	End       string `json:"end" yaml:"end"`
	Bucket    string `json:"bucket" yaml:"bucket"`
}

type LogInfo struct {
	Start     string `json:"start" yaml:"start"`
	Guid      string `json:"guid" yaml:"guid"`
	Container string `json:"container" yaml:"container"`
	End       string `json:"end" yaml:"end"`
}
